<?php

if( !ini_get('safe_mode')){
set_time_limit(0);
}else{
ini_set('max_execution_time',10000);
}


if(isset($_SERVER['HTTP_APPVERSION'])){
include "../saesiteinfo.php";
 }else{
include "../siteinfo.php";
 }
include '../function.php';
ignore_user_abort(true);
//date_default_timezone_set("Asia/Shanghai");
//$time=date("H");//获取当前时间
$localhost=mysql_connect($sqlhost,$sqluser,$sqlpass)or die('无法连接服务器');
mysql_select_db($sqldata,$localhost);
mysql_query("SELECT COUNT(id) FROM qqlist ");
$result=mysql_query("SELECT * FROM qqlist where zdsid=2");
//if ($time=="12" or $time=="23"){
//判断是否到了执行时间
while($row=mysql_fetch_array($result)){
//判断sid是否过期
$qq=$row['qq'];
$sid=$row['sid'];
$url='http://ish.z.qq.com/infocenter_v2.jsp?B_UID='.$qq.'&sid='.$sid.'&g_ut=1';
$yz_get=file_get_contents($url);
if(!strstr($yz_get,'个人中心')){
//开始
$out=newsid($row['qq'],tesy_decrypt($row['pw']));
if(preg_match("/操作异常/i",$out)){

mysql_query("UPDATE qqlist SET newsid='no' WHERE qid='".$row['qid']."'");
echo ' 更新失败';

}elseif(preg_match("/成功/i",$out)){

$outt=explode('sid=',$out);
$sid=substr($outt[1],0,24);
mysql_query("UPDATE qqlist SET sid='$sid',newsid='yes' WHERE qid='".$row['qid']."'");
mysql_query("UPDATE ".$row['fwq']." SET sid='$sid' WHERE qid='".$row['qid']."'");
echo ' 更新成功';

}
//结束 
//	   }

}else{
echo 'sid正常';
}
}
?>